import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目',
    align: "center",
    dataIndex: 'projectId_dictText'
  },
  {
    title: '会议日期',
    align: "center",
    sorter: true,
    dataIndex: 'meetingDay',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '风险',
    align: "center",
    dataIndex: 'riskTips'
  },
  {
    title: '晨会内容',
    align: "center",
    dataIndex: 'morningMeeting'
  },
  {
    title: '夕会内容',
    align: "center",
    dataIndex: 'eveningMeeting'
  },
  {
    title: '创建人',
    align: "center",
    sorter: true,
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align: "center",
    sorter: true,
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: "center",
    sorter: true,
    dataIndex: 'updateBy'
  },
  {
    title: '更新日期',
    align: "center",
    sorter: true,
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "项目",
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "会议日期",
    field: 'meetingDay',
    component: 'DatePicker',
    //colProps: {span: 6},
  },
  {
    label: "风险",
    field: 'riskTips',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "晨会内容",
    field: 'morningMeeting',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "夕会内容",
    field: 'eveningMeeting',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目',
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目!'},
             ];
    },
  },
  {
    label: '会议日期',
    field: 'meetingDay',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入会议日期!'},
             ];
    },
  },
  {
    label: '风险',
    field: 'riskTips',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入风险!'},
             ];
    },
  },
  {
    label: '晨会内容',
    field: 'morningMeeting',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入晨会内容!'},
             ];
    },
  },
  {
    label: '夕会内容',
    field: 'eveningMeeting',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入夕会内容!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
